package cn.jetpiece.cloud.config;

import cn.jetpiece.cloud.modular.doc.JetpieceSwaggerResourceProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.gateway.config.GatewayProperties;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * 文档配置
 *
 * @author XuJZ
 */
@Configuration
@ConditionalOnProperty(name = "jetpiece.gateway.doc", havingValue = "true")
public class DocConfig {

    @Bean
    public JetpieceSwaggerResourceProvider jetpieceSwaggerResourceProvider(RouteLocator routeLocator, GatewayProperties gatewayProperties, RedisTemplate<String, Object> redisTemplate) {
        return new JetpieceSwaggerResourceProvider(routeLocator, gatewayProperties, redisTemplate);
    }
}
